package com.thread.HashtableDemo;

import java.util.Hashtable;

/**
 * @Author milian
 * @Date 2021/7/31 0031 9:15
 */
public class demo1 {
    public static void main(String[] args) {
        Hashtable<String,String> hm = new Hashtable<>();
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 25; i++) {
                hm.put(i + "", i + "");
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 25; i < 51; i++) {
                hm.put(i + "", i + "");
            }
        });
        t1.start();
        t2.start();
        System.out.println("------------------");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 51; i++) {
            System.out.println(hm.get(i + ""));
        }
    }
}
